﻿using Coldairarrow.Business.Base_Manage;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Api.Controllers.Base_Manage
{
    [Route("/Base_Manage/[controller]/[action]")]
    public class Base_InterfaceOptionEntryLController : BaseApiController
    {
        #region DI

        public Base_InterfaceOptionEntryLController(IBase_InterfaceOptionEntryLBusiness Base_InterfaceOptionEntryLBus)
        {
            _Base_InterfaceOptionEntryLBus = Base_InterfaceOptionEntryLBus;
        }

        IBase_InterfaceOptionEntryLBusiness _Base_InterfaceOptionEntryLBus { get; }

        #endregion

        #region 获取

        [HttpPost]
        public async Task<PageResult<Base_InterfaceOptionEntryL>> GetDataList(PageInput<ConditionDTO> input)
        {
            return await _Base_InterfaceOptionEntryLBus.GetDataListAsync(input);
        }

        [HttpPost]
        public async Task<Base_InterfaceOptionEntryL> GetTheData(IdInputDTO input)
        {
            return await _Base_InterfaceOptionEntryLBus.GetTheDataAsync(input.id);
        }

        #endregion

        #region 提交

        [HttpPost]
        public async Task SaveData(Base_InterfaceOptionEntryL data)
        {
            if (data.Id.IsNullOrEmpty())
            {
                InitEntity(data);

                await _Base_InterfaceOptionEntryLBus.AddDataAsync(data);
            }
            else
            {
                await _Base_InterfaceOptionEntryLBus.UpdateDataAsync(data);
            }
        }

        [HttpPost]
        public async Task DeleteData(List<string> ids)
        {
            await _Base_InterfaceOptionEntryLBus.DeleteDataAsync(ids);
        }

        #endregion

    }
}